export default function stringToNodes(keyword, searchValue) {
  const nodes = []
  if (keyword.startsWith(searchValue)) {
    let key1 = keyword.slice(0, searchValue.length);
    const node1 = {
      name: "span",
      attrs: {
        style: "color:#26ce8a"
      },
      children: [{
        type: "text",
        text: key1
      }, ]
    }
    // 1 push node1
    nodes.push(node1)

    let key2 = keyword.slice(searchValue.length);
    const node2 = {
      name: "span",
      attrs: {
        style: "color:black"
      },
      children: [{
        type: "text",
        text: key2
      }, ]
    }
    // 2 push node2
    nodes.push(node2)
  } else {
    const node3 = {
      name: "span",
      attrs: {
        style: "color:black"
      },
      children: [{
        type: "text",
        text: keyword
      }, ]
    }
    // 3 push node3
    nodes.push(node3)
  }

  return nodes
}